﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using MvcExtensions;

namespace BlankMvc {
	/*public class RouteConfig {
		public static void RegisterRoutes(RouteCollection routes) {
			routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

			routes.MapRoute(
				name: "Default",
				url: "{controller}/{action}/{id}",
				defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
			);
		}
	}*/

	public class RegisterRoutes : RegisterRoutesBase {
		public RegisterRoutes(RouteCollection routes)
			: base(routes) {
		}

		protected override void Register() {
			Routes.Clear();
			Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
			Routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
			//Routes.MapRoute("Categorys", "Site/Category/{category}/{page}", new { category = "", page = UrlParameter.Optional });
			Routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" });
			Routes.MapRoute("Categorys", "{controller}/{action}/{id}/{page}", new { controller = "Home", action = "Index", id = "", page = UrlParameter.Optional });
			Routes.MapRoute("Posts", "{controller}/{action}/{year}/{month}/{day}/{title}", new { controller = "Home", action = "Post", year = "", month = "", day = "", title = "" });
			//Routes.MapRoute("Err", "{controller}/{action}", new { controller = "Errors", action = "Index" });

			/*Routes.Add(new Route("Account/Login", new MvcRouteHandler()) {
				Defaults = new RouteValueDictionary(new { controller = "Account", action = "Login" }),
				DataTokens = new RouteValueDictionary(new { scheme = "https" })
			});*/

		}
	}
}
